from django.test import TestCase
from django.test.client import Client

"""
Testira poredjenje igraca
"""
class Head2HeadTableFootballTestCase(TestCase):
    
    def setUp(self):
        pass

    def runTest(self):
        c = Client()
        c.login(username='kokan', password='123')
        
        response = c.get("/mdcs/head2head/table_football/5/7/")
        self.failIf(response == None)
        self.failIf(response.context == None)
        self.failUnlessEqual(len(response.context), 2)
        self.failIf(response.context[0]["h2hMatches"] == None)
        self.failIf(response.context[0]["statisticsH2H"] == None)
        self.failIf(response.context[0]["statistics1"] == None)
        self.failIf(response.context[0]["statistics2"] == None)
        self.failIf(response.context[0]["user1"] == None)
        self.failIf(response.context[0]["user2"] == None)
        self.failIf(response.context[0]["standing1"] == None)
        self.failIf(response.context[0]["standing2"] == None)
        
        user1 = response.context[0]["user1"]
        self.failUnlessEqual(user1.user.id, 5)
        
        user2 = response.context[0]["user2"]
        self.failUnlessEqual(user2.user.id, 7)
        
        standing1 = response.context[0]["standing1"]
        self.failUnlessEqual(standing1, 1)
        
        standing2 = response.context[0]["standing2"]
        self.failUnlessEqual(standing2, 11)